﻿@model PagedList<View_ChargeOrder>
@{
    ViewBag.Title = "充值订单列表";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";

    ChargeOrderQueryModel paramModel = new ChargeOrderQueryModel();
    if (ViewBag.paramModel != null)
    {
        paramModel = (ChargeOrderQueryModel)ViewBag.paramModel;
    }
    ADZ_MasterEntities dbcontext = new ADZ_MasterEntities();
    Dictionary<string, string> dc = new Dictionary<string, string>();
}

<form id="S_Form" class="form-inline definewidth m20" action="@Url.Action("getlist", "chargeorder")" method="get">
    <div class="form_query">
        <div>
            代购编号：
            <input type="text" name="replace_buyer_NO" id="replace_buyer_NO" class="abc input-default" placeholder="" value="@paramModel.replace_buyer_NO">&nbsp;
        </div>
        <div>
            会员手机号：
            <input type="text" name="account_mobile" id="account_mobile" class="abc input-default" placeholder="" value="@paramModel.account_mobile">&nbsp;
        </div>
        <div>
            会员名称：
            <input type="text" name="member_name" id="member_name" class="abc input-default" placeholder="" value="@paramModel.member_name">&nbsp;
        </div>
        <div>
            充值订单号：
            <input type="text" name="order_no" id="order_no" class="abc input-default" placeholder="" value="@paramModel.order_no">&nbsp;
        </div>
        <div>
            销售订单号：
            <input type="text" name="order_master_no" id="order_master_no" class="abc input-default" placeholder="" value="@paramModel.order_master_no">&nbsp;
        </div>
        <div>
            充值方式：
            <select id="channel_type" name="channel_type">
                <option value="-10" @(paramModel.channel_type == -10 ? "selected" : "")>全部充值方式</option>
                @{
                    dc = new Dictionary<string, string>();
                    var list = YiYiTong.Rocket.Helper.EnumHelper.GetEnumItems(typeof(ChannelType));
                    foreach (var item in list)
                    {
                        dc.Add(item.Value.ToString(), item.Description);
                    }
                }
                @HtmlPagerHelper.ShowSelectOpton(dc, paramModel.channel_type.ToString());
            </select>&nbsp;
        </div>
        <div>
            是否成功：
            <select id="issuccess" name="issuccess">
                <option value="-10" @(paramModel.issuccess == -10 ? "selected" : "")>全部</option>
                @{
                    dc = new Dictionary<string, string>();
                    dc.Add("0", "未成功");
                    dc.Add("1", "成功");
                }
                @HtmlPagerHelper.ShowSelectOpton(dc, paramModel.issuccess.ToString());
            </select>&nbsp;
        </div>
        <div>
            订单状态：
            <select id="status" name="status">
                <option value="-10" @(paramModel.status == -10 ? "selected" : "")>全部状态</option>
                @{
                    dc = new Dictionary<string, string>();
                    var statuslist = YiYiTong.Rocket.Helper.EnumHelper.GetEnumItems(typeof(ChargeOrderStatus));
                    foreach (var item in statuslist)
                    {
                        dc.Add(item.Value.ToString(), item.Description);
                    }
                }
                @HtmlPagerHelper.ShowSelectOpton(dc, paramModel.status.ToString());
            </select>&nbsp;
        </div>
        <div>
            下单时间：
            <input type="text" name="beg_time" class="calendar calendar-time" id="beg_time" value="@paramModel.beg_time.ToString(1)"> - <input type="text" name="end_time" class="calendar calendar-time" id="end_time" value="@paramModel.end_time.ToString(1)">&nbsp;
        </div>
        <div>
            提交时间：
            <input type="text" name="beg_succ_time" class="calendar calendar-time" id="beg_succ_time" value="@paramModel.beg_succ_time.ToString(1)"> - <input type="text" name="end_succ_time" class="calendar calendar-time" id="end_succ_time" value="@paramModel.end_succ_time.ToString(1)">&nbsp;
        </div>
        <div>
            @{Html.RenderPartial(Url.Content("~/Views/Common/PageSize.cshtml"), paramModel);}
        </div><div>
            <button type="submit" class="btn btn-primary">查询</button>&nbsp;&nbsp;
        </div>
    </div>
</form>

<table class="table table-bordered table-hover definewidth m10">
    <thead>
        <tr>
            <th>代购编号</th>
            <th>会员手机号</th>
            <th>会员名称</th>
            <th>充值订单号</th>
            <th>订单金额</th>
            <th>订单状态</th>
            <th>是否成功</th>
            <th>充值方式</th>
            <th>销售订单号</th>
            <th>下单时间</th>
            <th>提交时间</th>
            <th>操作</th>
        </tr>
    </thead>
    @if (Model != null && Model.Count != 0)
    {
        int index = 0;
        foreach (var m in Model)
        {
            index++;
            <tr class="@HtmlPagerHelper.TrClass(index)">
                <td>@m.replace_buyer_NO</td>
                <td>@m.account_mobile</td>
                <td>@m.member_name</td>
                <td>@m.order_no </td>
                <td>@m.order_amt </td>
                <td>
                    @{
                        int order_status = ConvertHelper.ConvertTo<int>(m.status, 0);
                        switch (order_status)
                        {
                            case (int)ChargeOrderStatus.Create:
                                @:<div>@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;
                            case (int)ChargeOrderStatus.PaySucc:
                                @:<div class="green">@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;
                            case (int)ChargeOrderStatus.PayFail:
                                @:<div class="red">@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;
                            @*case (int)ChargeOrderStatus.Refund:
                                @:<div class="gray">@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;
                            case (int)ChargeOrderStatus.Cancel:
                                @:<div class="blue">@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;
                            case (int)ChargeOrderStatus.Close:
                                @:<div class="red">@(MyEnumHelper.GetEnumItemDescription<ChargeOrderStatus>(order_status))</div>
                                break;*@
                        }
                    }
                </td>
                <td>
                    @switch (m.issuccess)
                    {
                        case 1:
                            @:<div class="green">成功</div>
                            break;
                        case 0:
                            @:<div class="red">未成功</div>
                            break;
                    }
                </td>
                <td>
                    @(MyEnumHelper.GetEnumItemDescription<ChannelType>(ConvertHelper.ConvertTo<int>(m.channel_type)))
                </td>
                <td>@m.order_master_no</td>
                <td>@m.createtime.ToString(1)</td>
                <td>@m.succ_time.ToString(1)</td>
                <td>
                    <a href="@Url.Action("defail", "chargeorder", new { order_id = m.order_id})">详情</a>
                </td>
            </tr>
                            }
                        }
</table>
<div class="inline pull-left total">
    总行数：@ViewData["AllCount"] | 总订单金额：@ViewData["AllOrderAmt"]
</div>
<div class="inline pull-right page">
    @if (Model != null)
    {
        @Html.Pager(Model, HtmlPagerHelper.BasePagerOption)
    }
</div>

